#include <cstdio>

using namespace std;

int in[1005] = {0};

int main()
{
    int i = 0;
    while(1){
        scanf("%d %d", &in[i], &in[i+1]);
        if(getchar() == '\n'){ break; }
        i += 2;
    }
    bool flag = false;
    for(int j = 0; j <= i; j += 2){
        if(in[j+1] != 0 && in[j] != 0){
            flag = true;
            printf("%s%d %d", !j ? "" : " ", in[j]*in[j+1], in[j+1]-1);
        }
    }
    if(!flag){ printf("0 0"); } //特殊情况，输入为0 0
    printf("\n");
    return 0;
}
